package com.study.selection.service;

import com.study.selection.dao.SelectDao;
import com.study.selection.model.Select;
import com.study.selection.model.Select;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SelectServiceImpl implements SelectService{
    @Autowired
    private SelectDao selectDao;

    @Override
    public List<Select> findAll() {
        return selectDao.findAll();
    }

    @Override
    public List<Select> findByKey(String key) {
        return selectDao.findByKey(key);
    }

    @Override
    public boolean addSelect(Select select) {
        return selectDao.addSelect(select) > 0 ? true : false;
    }
    @Override
    public Select getBySelectId(int selectId) {
        return selectDao.getBySelectId(selectId);
    }
    @Override
    public List<Select>getByCourseId(int courseId){
        return selectDao.getByCourseId(courseId);
    }
    @Override
    public List<Select>getByStudentId(int studentId){
        return selectDao.getByStudentId(studentId);
    }

    @Override
    public List<Select>getByTeacherId(int teacherId){
        return selectDao.getByTeacherId(teacherId);
    }
    @Override
    public boolean updateSelect(Select select) {
        return selectDao.updateSelect(select) > 0 ? true : false;
    }
    @Override
    public boolean deleteSelect(int selectId) {
        return selectDao.deleteSelect(selectId) > 0 ? true : false;
    }

}
